# -*- coding: utf-8 -*-
"""
-------------------------------------------------
   File Name：     day132_pyqt5_sender
   Description :
   Author :       fuml
   date：          2019/9/21
-------------------------------------------------
   Change Activity:
                   2019/9/21:In this example, we determine the event sender
object.
-------------------------------------------------
"""
import  sys
from PyQt5.QtCore import pyqtBoundSignal
from PyQt5.QtWidgets import  QMainWindow,QApplication,QPushButton

class Example(QMainWindow):
    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        btn1 = QPushButton('button1',self)
        btn1.move(30,50)

        btn2 = QPushButton('button2',self)
        btn2.move(150,50)

        btn1.clicked.connect(self.buttonClicked)
        btn2.clicked.connect(self.buttonClicked)
        #self.statusBar()
        self.stbar = self.statusBar()

        self.setGeometry(300,300,250,150)
        self.setWindowTitle('Event sender')
        self.show()

    def buttonClicked(self):
        sender= self.sender()
        self.stbar.showMessage(sender.text()+'was pressed')
        #self.statusBar().showMessage()

if __name__ == '__main__':
    app= QApplication(sys.argv)
    ex = Example()
    sys.exit(app.exec_())